#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: use_checker.py 
@version:
@time: 2021/10/12 
"""
from pprint import pprint

from TapClientCore.data_inspect_templates.checker import *
from bson import Decimal128
import datetime

from TapClientCore.other_config import log


class UseChecker:

    @classmethod
    def mongodb_to_list(cls, data, k, columns):
        if k == "0":
            # 获取第一层
            tmp = []
            for data_t0 in data:
                # 获取一个数据项
                t0_list = []
                for t0 in columns:
                    if isinstance(data_t0[t0], Decimal128):
                        data_t0[t0] = data_t0[t0].to_decimal()
                    if isinstance(data_t0[t0], list):
                        data_t0[t0] = str(data_t0[t0])
                    t0_list.append(data_t0[t0])
                tmp.append(t0_list)
            return tmp, False
        elif type(data[0][k]) is dict:
            tmp = []
            for data_t0 in data:
                # 获取一个数据项
                t0_list = []
                for t0 in columns:
                    if isinstance(data_t0[k][t0], Decimal128):
                        data_t0[k][t0] = data_t0[k][t0].to_decimal()
                    t0_list.append(data_t0[k][t0])
                tmp.append(t0_list)
            log.info(f"{k} length is {len(tmp)}")
            return tmp, len(tmp)
        elif type(data[0][k]) is list:
            tmp_raw = []
            # 获取一层数据
            for data_t1 in data:
                tmp_raw.extend(data_t1[k])
            tmp = []
            for data_t0 in tmp_raw:
                # 获取一个数据项
                t0_list = []
                for t0 in columns:
                    if isinstance(data_t0[t0], Decimal128):
                        data_t0[t0] = data_t0[t0].to_decimal()
                    t0_list.append(data_t0[t0])
                tmp.append(t0_list)
            log.info(f"{k} length is {len(tmp)}")
            return tmp, len(tmp)
        else:
            raise Exception

    @classmethod
    def check_result_data(cls, source, target, column, pk):
        for check_k, check_v in column.items():
            _source, len1 = cls.mongodb_to_list(source, check_k, check_v)
            _target, len2 = cls.mongodb_to_list(target, check_k, check_v)
            if len1:
                assert len1 == len2
            df1 = Checker.list_to_dataframe(_source, check_v, pk)
            df2 = Checker.list_to_dataframe(_target, check_v, pk)
            res, source_, target_ = Checker.check(df1, df2)
            if not res.empty:
                html = Checker.print_html_result(res=res, source=source_, target=target_, pk=pk)
                print(html)
                return html
            else:
                return False


if __name__ == '__main__':
    pk = None
    columns = [{
        '0': ["POLICY_ID", "COVER_START", "CUSTOMER_ID", "LAST_ANN_PREMIUM_GROSS", "LAST_CHANGE",
              "POLICY_STATUS", "QUOTE_DAY"]},
        {"AUTO_CUSTOMER":
             ["CITY", "COUNTRY_CODE", "CUSTOMER_ID", "DATE_OF_BIRTH", "EMAIL",
              "FIRST_NAME",
              "GENDER", "JOB", "LAST_CHANGE", "LAST_NAME", "MARITAL_STATUS",
              "NATIONALITY",
              "NUMBER_CHILDREN", "PHONE", "STREET", "ZIP"]
         }]
    source_1 = [
        {'POLICY_ID': 'P000000001', 'COVER_START': datetime.datetime(1999, 8, 1, 6, 59, 31),
         'CUSTOMER_ID': 'C000013356',
         'LAST_ANN_PREMIUM_GROSS': 274.0, 'LAST_CHANGE': datetime.datetime(2019, 7, 4, 17, 13, 55, 740000),
         'POLICY_STATUS': 'Lapsed', 'QUOTE_DAY': datetime.datetime(1999, 7, 7, 6, 59, 31),
         'AUTO_CUSTOMER': {'CITY': 'Dvos*', 'COUNTRY_CODE': 'CH', 'CUSTOMER_ID': 'C000013356',
                           'DATE_OF_BIRTH': datetime.datetime(1933, 1, 22, 22, 0), 'EMAIL': 'yak1919@yahoo.com',
                           'FIRST_NAME': 'Walpurga', 'GENDER': 'F', 'JOB': 'Ingenieur / Ingenieurin',
                           'LAST_CHANGE': datetime.datetime(2019, 7, 4, 17, 13, 55, 907000), 'LAST_NAME': 'Pfyffer',
                           'MARITAL_STATUS': 'WIDOWED', 'NATIONALITY': 'Switzerland',
                           'NUMBER_CHILDREN': Decimal128('4'),
                           'PHONE': '+41 11 887 42 57', 'STREET': 'Reinacherstrasse 1393', 'ZIP': '7017'}},
        {'POLICY_ID': 'P000000002', 'COVER_START': datetime.datetime(1999, 9, 1, 9, 23, 40),
         'CUSTOMER_ID': 'C000060613',
         'LAST_ANN_PREMIUM_GROSS': 308.0, 'LAST_CHANGE': datetime.datetime(2019, 7, 4, 17, 13, 55, 740000),
         'POLICY_STATUS': 'Live', 'QUOTE_DAY': datetime.datetime(1999, 8, 1, 9, 23, 40),
         'AUTO_CUSTOMER': {'CITY': 'Villars-sur-Glâne', 'COUNTRY_CODE': 'CH', 'CUSTOMER_ID': 'C000060613',
                           'DATE_OF_BIRTH': datetime.datetime(1981, 7, 30, 22, 0), 'EMAIL': 'modestly2017@yahoo.com',
                           'FIRST_NAME': 'Walfried', 'GENDER': 'M', 'JOB': 'Apotheker / Apothekerin',
                           'LAST_CHANGE': datetime.datetime(2019, 7, 4, 17, 13, 55, 907000), 'LAST_NAME': 'Buchman',
                           'MARITAL_STATUS': 'MARRIED', 'NATIONALITY': 'Switzerland',
                           'NUMBER_CHILDREN': Decimal128('0'),
                           'PHONE': '+41 43 160 15 09', 'STREET': 'Kanonengasse 113', 'ZIP': '7667'}}, ]
    target_1 = [
        {'POLICY_ID': '000000001', 'COVER_START': datetime.datetime(1999, 8, 1, 6, 59, 31),
         'CUSTOMER_ID': 'C000013356',
         'LAST_ANN_PREMIUM_GROSS': 274.0, 'LAST_CHANGE': datetime.datetime(2019, 7, 4, 17, 13, 55, 740000),
         'POLICY_STATUS': 'Lapsed', 'QUOTE_DAY': datetime.datetime(1999, 7, 7, 6, 59, 31),
         'AUTO_CUSTOMER': {'CITY': 'Davos*', 'COUNTRY_CODE': 'CH', 'CUSTOMER_ID': 'C000013356',
                           'DATE_OF_BIRTH': datetime.datetime(1933, 1, 22, 22, 0), 'EMAIL': 'yak1919@yahoo.com',
                           'FIRST_NAME': 'Walpurga', 'GENDER': 'F', 'JOB': 'Ingenieur / Ingenieurin',
                           'LAST_CHANGE': datetime.datetime(2019, 7, 4, 17, 13, 55, 907000), 'LAST_NAME': 'Pfyffer',
                           'MARITAL_STATUS': 'WIDOWED', 'NATIONALITY': 'Switzerland',
                           'NUMBER_CHILDREN': Decimal128('4'),
                           'PHONE': '+41 11 887 42 57', 'STREET': 'Reinacherstrasse 1393', 'ZIP': '7017'}},
        {'POLICY_ID': 'P000000002', 'COVER_START': datetime.datetime(1999, 9, 1, 9, 23, 40),
         'CUSTOMER_ID': 'C000060613',
         'LAST_ANN_PREMIUM_GROSS': 308.0, 'LAST_CHANGE': datetime.datetime(2019, 7, 4, 17, 13, 55, 740000),
         'POLICY_STATUS': 'Live', 'QUOTE_DAY': datetime.datetime(1999, 8, 1, 9, 23, 40),
         'AUTO_CUSTOMER': {'CITY': 'Villars-sur-Glâne', 'COUNTRY_CODE': 'CH', 'CUSTOMER_ID': 'C000060613',
                           'DATE_OF_BIRTH': datetime.datetime(1981, 7, 30, 22, 0), 'EMAIL': 'modestly2017@yahoo.com',
                           'FIRST_NAME': 'Walfried', 'GENDER': 'M', 'JOB': 'Apotheker / Apothekerin',
                           'LAST_CHANGE': datetime.datetime(2019, 7, 4, 17, 13, 55, 907000), 'LAST_NAME': 'Buchman',
                           'MARITAL_STATUS': 'MARRIED', 'NATIONALITY': 'Switzerland',
                           'NUMBER_CHILDREN': Decimal128('0'),
                           'PHONE': '+41 43 160 15 09', 'STREET': 'Kanonengasse 113', 'ZIP': '7667'}}, ]
    for column in columns:
        UseChecker.check_result_data(source_1, target_1, column, pk)

    pk = None
    columns = [
        {'0': ["CUSTOMER_ID", "CITY", "COUNTRY_CODE", "DATE_OF_BIRTH", "EMAIL",
               "FIRST_NAME", "GENDER", "JOB", "LAST_CHANGE", "LAST_NAME", "MARITAL_STATUS", "NATIONALITY",
               "NUMBER_CHILDREN", "PHONE", "STREET", "ZIP"]},
        {'POLICY_LIST':
             ["POLICY_ID", "COVER_START", "CUSTOMER_ID", "LAST_ANN_PREMIUM_GROSS", "LAST_CHANGE",
              "POLICY_STATUS", "QUOTE_DAY"]}]
    source_1 = [
        {'CUSTOMER_ID': 'C00034461',
         'CITY': 'Linz',
         'COUNTRY_CODE': 'AT',
         'DATE_OF_BIRTH': datetime.datetime(1954, 9, 11, 22, 0),
         'EMAIL': 'dupable1910@yandex.com',
         'FIRST_NAME': 'Yvonne',
         'GENDER': 'F',
         'JOB': 'Apotheker / Apothekerin',
         'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43, 137000),
         'LAST_NAME': 'Haschke',
         'MARITAL_STATUS': 'WIDOWED',
         'NATIONALITY': 'Austria',
         'NUMBER_CHILDREN': Decimal128('3'),
         'PHONE': '+43-617-3278926',
         'STREET': 'Heinrich-Mitteis-Gasse 1133',
         'ZIP': '8155',
         '__tapd8': {'after': {'ZIP': '8155', 'NATIONALITY': 'Austria', 'NUMBER_CHILDREN': Decimal128('3'),
                               'MARITAL_STATUS': 'WIDOWED', 'PHONE': '+43-617-3278926', 'CUSTOMER_ID': 'C000034461',
                               'STREET': 'Heinrich-Mitteis-Gasse 1133', 'LAST_NAME': 'Haschke',
                               'EMAIL': 'dupable1910@yandex.com',
                               'FIRST_NAME': 'Yvonne', 'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43, 137000),
                               'CITY': 'Linz', 'GENDER': 'F', 'JOB': 'Apotheker / Apothekerin',
                               'DATE_OF_BIRTH': datetime.datetime(1954, 9, 11, 22, 0), 'COUNTRY_CODE': 'AT'}},
         'POLICY_LIST': [
             {'POLICY_STATUS': 'Lase', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 274.0,
              'POLICY_ID': 'P000000001', 'COVER_START': datetime.datetime(1999, 8, 1, 6, 59, 31),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 7, 7, 6, 59, 31)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 308.0,
              'POLICY_ID': 'P000000002', 'COVER_START': datetime.datetime(1999, 9, 1, 9, 23, 40),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 8, 1, 9, 23, 40)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 52.0,
              'POLICY_ID': 'P000000003', 'COVER_START': datetime.datetime(1999, 10, 1, 9, 19, 13),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 9, 14, 9, 19, 13)}]},
        {'CUSTOMER_ID': 'C000034501', 'CITY': 'Romrod', 'COUNTRY_CODE': 'DE',
         'DATE_OF_BIRTH': datetime.datetime(1954, 9, 24, 22, 0),
         'EMAIL': 'agnoite1962@gmail.com',
         'FIRST_NAME': 'Philip', 'GENDER': 'M',
         'JOB': 'Feuerwehrmann / Feuerwehrfrau',
         'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43, 137000),
         'LAST_NAME': 'Amsel',
         'MARITAL_STATUS': 'SINGLE', 'NATIONALITY': 'Germany',
         'NUMBER_CHILDREN': Decimal128('2'),
         'PHONE': '(03722) 7315775', 'STREET': 'Prinzregentenstraße 220',
         'ZIP': '61705', '__tapd8': {
            'after': {'ZIP': '61705', 'NATIONALITY': 'Germany',
                      'NUMBER_CHILDREN': Decimal128('2'),
                      'MARITAL_STATUS': 'SINGLE', 'PHONE': '(03722) 7315775',
                      'CUSTOMER_ID': 'C000034501',
                      'STREET': 'Prinzregentenstraße 220', 'LAST_NAME': 'Amsel',
                      'EMAIL': 'agnoite1962@gmail.com', 'FIRST_NAME': 'Philip',
                      'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43,
                                                       137000), 'CITY': 'Romrod',
                      'GENDER': 'M', 'JOB': 'Feuerwehrmann / Feuerwehrfrau',
                      'DATE_OF_BIRTH': datetime.datetime(1954, 9, 24, 22, 0),
                      'COUNTRY_CODE': 'DE'}},
         'POLICY_LIST': [
             {'POLICY_STATUS': 'Lased', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 274.0,
              'POLICY_ID': 'P000000001', 'COVER_START': datetime.datetime(1999, 8, 1, 6, 59, 31),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 7, 7, 6, 59, 31)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 308.0,
              'POLICY_ID': 'P000000002', 'COVER_START': datetime.datetime(1999, 9, 1, 9, 23, 40),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 8, 1, 9, 23, 40)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 52.0,
              'POLICY_ID': 'P000000003', 'COVER_START': datetime.datetime(1999, 10, 1, 9, 19, 13),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 9, 14, 9, 19, 13)}]
         },
        {'CUSTOMER_ID': 'C000034624', 'CITY': 'Gleisdorf', 'COUNTRY_CODE': 'AT',
         'DATE_OF_BIRTH': datetime.datetime(1954, 11, 9, 22, 0),
         'EMAIL': 'quackster1847@gmail.com',
         'FIRST_NAME': 'Ulbrecht', 'GENDER': 'M',
         'JOB': 'Dolmetscher / Dolmetscherin',
         'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43, 137000),
         'LAST_NAME': 'Cornelsen',
         'MARITAL_STATUS': 'DIVORCED', 'NATIONALITY': 'Austria',
         'NUMBER_CHILDREN': Decimal128('2'),
         'PHONE': '+43-689-0553333', 'STREET': 'Wienerberg 1009', 'ZIP': '3684',
         '__tapd8': {
             'after': {'ZIP': '3684', 'NATIONALITY': 'Austria',
                       'NUMBER_CHILDREN': Decimal128('2'),
                       'MARITAL_STATUS': 'DIVORCED', 'PHONE': '+43-689-0553333',
                       'CUSTOMER_ID': 'C000034624',
                       'STREET': 'Wienerberg 1009', 'LAST_NAME': 'Cornelsen',
                       'EMAIL': 'quackster1847@gmail.com',
                       'FIRST_NAME': 'Ulbrecht',
                       'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43,
                                                        137000),
                       'CITY': 'Gleisdorf',
                       'GENDER': 'M', 'JOB': 'Dolmetscher / Dolmetscherin',
                       'DATE_OF_BIRTH': datetime.datetime(1954, 11, 9, 22, 0),
                       'COUNTRY_CODE': 'AT'}},
         'POLICY_LIST': [
             {'POLICY_STATUS': 'Lased', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 274.0,
              'POLICY_ID': 'P000000001', 'COVER_START': datetime.datetime(1999, 8, 1, 6, 59, 31),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 7, 7, 6, 59, 31)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 308.0,
              'POLICY_ID': 'P000000002', 'COVER_START': datetime.datetime(1999, 9, 1, 9, 23, 40),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 8, 1, 9, 23, 40)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 52.0,
              'POLICY_ID': 'P000000003', 'COVER_START': datetime.datetime(1999, 10, 1, 9, 19, 13),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 9, 14, 9, 19, 13)}]
         }]
    target_1 = [
        {'CUSTOMER_ID': 'C000034461',
         'CITY': 'Linz',
         'COUNTRY_CODE': 'AT',
         'DATE_OF_BIRTH': datetime.datetime(1954, 9, 11, 22, 0),
         'EMAIL': 'dupable1910@yandex.com',
         'FIRST_NAME': 'Yvonne',
         'GENDER': 'F',
         'JOB': 'Apotheker / Apothekerin',
         'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43, 137000),
         'LAST_NAME': 'Haschke',
         'MARITAL_STATUS': 'WIDOWED',
         'NATIONALITY': 'Austria',
         'NUMBER_CHILDREN': Decimal128('3'),
         'PHONE': '+43-617-3278926',
         'STREET': 'Heinrich-Mitteis-Gasse 1133',
         'ZIP': '8155',
         '__tapd8': {'after': {'ZIP': '8155', 'NATIONALITY': 'Austria', 'NUMBER_CHILDREN': Decimal128('3'),
                               'MARITAL_STATUS': 'WIDOWED', 'PHONE': '+43-617-3278926', 'CUSTOMER_ID': 'C000034461',
                               'STREET': 'Heinrich-Mitteis-Gasse 1133', 'LAST_NAME': 'Haschke',
                               'EMAIL': 'dupable1910@yandex.com',
                               'FIRST_NAME': 'Yvonne', 'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43, 137000),
                               'CITY': 'Linz', 'GENDER': 'F', 'JOB': 'Apotheker / Apothekerin',
                               'DATE_OF_BIRTH': datetime.datetime(1954, 9, 11, 22, 0), 'COUNTRY_CODE': 'AT'}},
         'POLICY_LIST': [
             {'POLICY_STATUS': 'Lased', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 274.0,
              'POLICY_ID': 'P000000001', 'COVER_START': datetime.datetime(1999, 8, 1, 6, 59, 31),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 7, 7, 6, 59, 31)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 308.0,
              'POLICY_ID': 'P000000002', 'COVER_START': datetime.datetime(1999, 9, 1, 9, 23, 40),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 8, 1, 9, 23, 40)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 52.0,
              'POLICY_ID': 'P000000003', 'COVER_START': datetime.datetime(1999, 10, 1, 9, 19, 13),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 9, 14, 9, 19, 13)}]},
        {'CUSTOMER_ID': 'C000034501', 'CITY': 'Romrod', 'COUNTRY_CODE': 'DE',
         'DATE_OF_BIRTH': datetime.datetime(1954, 9, 24, 22, 0),
         'EMAIL': 'agnoite1962@gmail.com',
         'FIRST_NAME': 'Philip', 'GENDER': 'M',
         'JOB': 'Feuerwehrmann / Feuerwehrfrau',
         'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43, 137000),
         'LAST_NAME': 'Amsel',
         'MARITAL_STATUS': 'SINGLE', 'NATIONALITY': 'Germany',
         'NUMBER_CHILDREN': Decimal128('2'),
         'PHONE': '(03722) 7315775', 'STREET': 'Prinzregentenstraße 220',
         'ZIP': '61705', '__tapd8': {
            'after': {'ZIP': '61705', 'NATIONALITY': 'Germany',
                      'NUMBER_CHILDREN': Decimal128('2'),
                      'MARITAL_STATUS': 'SINGLE', 'PHONE': '(03722) 7315775',
                      'CUSTOMER_ID': 'C000034501',
                      'STREET': 'Prinzregentenstraße 220', 'LAST_NAME': 'Amsel',
                      'EMAIL': 'agnoite1962@gmail.com', 'FIRST_NAME': 'Philip',
                      'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43,
                                                       137000), 'CITY': 'Romrod',
                      'GENDER': 'M', 'JOB': 'Feuerwehrmann / Feuerwehrfrau',
                      'DATE_OF_BIRTH': datetime.datetime(1954, 9, 24, 22, 0),
                      'COUNTRY_CODE': 'DE'}},
         'POLICY_LIST': [
             {'POLICY_STATUS': 'Lased', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 274.0,
              'POLICY_ID': 'P000000001', 'COVER_START': datetime.datetime(1999, 8, 1, 6, 59, 31),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 7, 7, 6, 59, 31)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 308.0,
              'POLICY_ID': 'P000000002', 'COVER_START': datetime.datetime(1999, 9, 1, 9, 23, 40),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 8, 1, 9, 23, 40)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 52.0,
              'POLICY_ID': 'P000000003', 'COVER_START': datetime.datetime(1999, 10, 1, 9, 19, 13),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 9, 14, 9, 19, 13)}]
         },
        {'CUSTOMER_ID': 'C000034624', 'CITY': 'Gleisdorf', 'COUNTRY_CODE': 'AT',
         'DATE_OF_BIRTH': datetime.datetime(1954, 11, 9, 22, 0),
         'EMAIL': 'quackster1847@gmail.com',
         'FIRST_NAME': 'Ulbrecht', 'GENDER': 'M',
         'JOB': 'Dolmetscher / Dolmetscherin',
         'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43, 137000),
         'LAST_NAME': 'Cornelsen',
         'MARITAL_STATUS': 'DIVORCED', 'NATIONALITY': 'Austria',
         'NUMBER_CHILDREN': Decimal128('2'),
         'PHONE': '+43-689-0553333', 'STREET': 'Wienerberg 1009', 'ZIP': '3684',
         '__tapd8': {
             'after': {'ZIP': '3684', 'NATIONALITY': 'Austria',
                       'NUMBER_CHILDREN': Decimal128('2'),
                       'MARITAL_STATUS': 'DIVORCED', 'PHONE': '+43-689-0553333',
                       'CUSTOMER_ID': 'C000034624',
                       'STREET': 'Wienerberg 1009', 'LAST_NAME': 'Cornelsen',
                       'EMAIL': 'quackster1847@gmail.com',
                       'FIRST_NAME': 'Ulbrecht',
                       'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 43,
                                                        137000),
                       'CITY': 'Gleisdorf',
                       'GENDER': 'M', 'JOB': 'Dolmetscher / Dolmetscherin',
                       'DATE_OF_BIRTH': datetime.datetime(1954, 11, 9, 22, 0),
                       'COUNTRY_CODE': 'AT'}},
         'POLICY_LIST': [
             {'POLICY_STATUS': 'Lased', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 274.0,
              'POLICY_ID': 'P000000001', 'COVER_START': datetime.datetime(1999, 8, 1, 6, 59, 31),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 7, 7, 6, 59, 31)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 308.0,
              'POLICY_ID': 'P000000002', 'COVER_START': datetime.datetime(1999, 9, 1, 9, 23, 40),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 8, 1, 9, 23, 40)},
             {'POLICY_STATUS': 'Live', 'CUSTOMER_ID': 'C000034461', 'LAST_ANN_PREMIUM_GROSS': 52.0,
              'POLICY_ID': 'P000000003', 'COVER_START': datetime.datetime(1999, 10, 1, 9, 19, 13),
              'LAST_CHANGE': datetime.datetime(2019, 7, 4, 15, 13, 55, 740000),
              'QUOTE_DAY': datetime.datetime(1999, 9, 14, 9, 19, 13)}]
         }]
    for column in columns:
        UseChecker.check_result_data(source_1, target_1, column, pk)
